package hotel.switchs.oversea.online.service.impl;

import hotel.base.oversea.service.impl.BaseServiceImpl;
import hotel.switchs.oversea.api.entity.SwitchRoomPriceSetEntity;
import hotel.switchs.oversea.online.mapper.SwitchRoomPriceSetMapper;
import hotel.switchs.oversea.online.service.SwitchRoomPriceSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author lmf
 * @Date 2020/6/23 18:12
 **/
@Service
public class SwitchRoomPriceSetServiceImpl extends BaseServiceImpl<SwitchRoomPriceSetEntity>  implements SwitchRoomPriceSetService {
    @Autowired
    SwitchRoomPriceSetMapper switchRoomPriceSetMapper;
    /**
     * 根据城市获取对应的配置数据
     */
    @Override
    public SwitchRoomPriceSetEntity selectByCityNameAndTime(String cityName) {
        return switchRoomPriceSetMapper.selectByCityNameAndTime(cityName,new Date());
    }
    /**
     * 根据城市和星级获取对应的配置数据
     */
    @Override
    public SwitchRoomPriceSetEntity selectByCityNameAndStarAndTime(String cityName, int star) {
        return switchRoomPriceSetMapper.selectByCityNameAndStarAndTime(cityName,star,new Date());
    }
    /**
     * 根据星级获取对应的配置数据
     */
    @Override
    public SwitchRoomPriceSetEntity selectByStarAndTime(int star) {
        return switchRoomPriceSetMapper.selectByStarAndTime(star,new Date());
    }
    /**
     * 统一的配置数据
     */
    @Override
    public SwitchRoomPriceSetEntity selectByTime() {
        return switchRoomPriceSetMapper.selectByTime(new Date());
    }
    /**
     * @author: lmf
     * @date: 2020/9/8 10:58
     * 根据渠道来获取对应价格公式配置
     */
    @Override
    public SwitchRoomPriceSetEntity selectByChannel(String channel){
        return switchRoomPriceSetMapper.selectByChannel(channel);
    }
}
